﻿﻿using System;
using System.Collections.Generic;
using System.Text;
namespace WebApplication1.DDD.Models.Entity.Common
{
    public class article:NFinal.Struct
    {
		public System.Int64 id;
		public System.Int64? channel_id;
		public System.Int64? category_id;
		public System.String title;
		public System.String link_url;
		public System.String img_url;
		public System.String seo_title;
		public System.String seo_description;
		public System.String tags;
		public System.String zhaiyao;
		public System.String content;
		public System.Int64? sort_id;
		public System.Int64? click;
		public System.Int64? status;
		public System.Int16? is_msg;
		public System.Int16? is_top;
		public System.Int16? is_red;
		public System.Int16? is_hot;
		public System.Int16? is_slide;
		public System.Int16? is_sys;
		public System.String user_name;
		public System.DateTime? add_time;
		public System.DateTime? update_time;
		public System.Int64? user_id;
		#region 从get列表初始化实体类
		public static bool TryParse(NFinal.NameValueCollection get,out article par)
		{
			par=new article();
			try
			{
						System.Int64.TryParse(get["id"],out par.id);
						par.channel_id=null;
						if(get["channel_id"]!=null)
						{
							par.channel_id=System.Int64.Parse(get["channel_id"]);
						}
						par.category_id=null;
						if(get["category_id"]!=null)
						{
							par.category_id=System.Int64.Parse(get["category_id"]);
						}
						par.title=get["title"];
						par.link_url=get["link_url"];
						par.img_url=get["img_url"];
						par.seo_title=get["seo_title"];
						par.seo_description=get["seo_description"];
						par.tags=get["tags"];
						par.zhaiyao=get["zhaiyao"];
						par.content=get["content"];
						par.sort_id=null;
						if(get["sort_id"]!=null)
						{
							par.sort_id=System.Int64.Parse(get["sort_id"]);
						}
						par.click=null;
						if(get["click"]!=null)
						{
							par.click=System.Int64.Parse(get["click"]);
						}
						par.status=null;
						if(get["status"]!=null)
						{
							par.status=System.Int64.Parse(get["status"]);
						}
						par.is_msg=null;
						if(get["is_msg"]!=null)
						{
							par.is_msg=System.Int16.Parse(get["is_msg"]);
						}
						par.is_top=null;
						if(get["is_top"]!=null)
						{
							par.is_top=System.Int16.Parse(get["is_top"]);
						}
						par.is_red=null;
						if(get["is_red"]!=null)
						{
							par.is_red=System.Int16.Parse(get["is_red"]);
						}
						par.is_hot=null;
						if(get["is_hot"]!=null)
						{
							par.is_hot=System.Int16.Parse(get["is_hot"]);
						}
						par.is_slide=null;
						if(get["is_slide"]!=null)
						{
							par.is_slide=System.Int16.Parse(get["is_slide"]);
						}
						par.is_sys=null;
						if(get["is_sys"]!=null)
						{
							par.is_sys=System.Int16.Parse(get["is_sys"]);
						}
						par.user_name=get["user_name"];
						par.add_time=null;
						if(get["add_time"]!=null)
						{
							par.add_time=System.DateTime.Parse(get["add_time"]);
						}
						par.update_time=null;
						if(get["update_time"]!=null)
						{
							par.update_time=System.DateTime.Parse(get["update_time"]);
						}
						par.user_id=null;
						if(get["user_id"]!=null)
						{
							par.user_id=System.Int64.Parse(get["user_id"]);
						}
			}
			catch
			{
				return false;
			}
			return true;
		}
		#endregion
		#region 写Json字符串
		public override void WriteJson(System.IO.TextWriter tw)
		{
			tw.Write("{");
					tw.Write("\"id\":");
					tw.Write(id.ToString());
					tw.Write(",");
					tw.Write("\"channel_id\":");
					tw.Write(channel_id==null?"null" : channel_id.ToString());
					tw.Write(",");
					tw.Write("\"category_id\":");
					tw.Write(category_id==null?"null" : category_id.ToString());
					tw.Write(",");
					tw.Write("\"title\":");
					tw.Write("\"");
					tw.Write(title==null?"null":title);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"link_url\":");
					tw.Write("\"");
					tw.Write(link_url==null?"null":link_url);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"img_url\":");
					tw.Write("\"");
					tw.Write(img_url==null?"null":img_url);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"seo_title\":");
					tw.Write("\"");
					tw.Write(seo_title==null?"null":seo_title);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"seo_description\":");
					tw.Write("\"");
					tw.Write(seo_description==null?"null":seo_description);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"tags\":");
					tw.Write("\"");
					tw.Write(tags==null?"null":tags);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"zhaiyao\":");
					tw.Write("\"");
					tw.Write(zhaiyao==null?"null":zhaiyao);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"content\":");
					tw.Write("\"");
					tw.Write(content==null?"null":content);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"sort_id\":");
					tw.Write(sort_id==null?"null" : sort_id.ToString());
					tw.Write(",");
					tw.Write("\"click\":");
					tw.Write(click==null?"null" : click.ToString());
					tw.Write(",");
					tw.Write("\"status\":");
					tw.Write(status==null?"null" : status.ToString());
					tw.Write(",");
					tw.Write("\"is_msg\":");
					tw.Write(is_msg==null?"null" : is_msg.ToString());
					tw.Write(",");
					tw.Write("\"is_top\":");
					tw.Write(is_top==null?"null" : is_top.ToString());
					tw.Write(",");
					tw.Write("\"is_red\":");
					tw.Write(is_red==null?"null" : is_red.ToString());
					tw.Write(",");
					tw.Write("\"is_hot\":");
					tw.Write(is_hot==null?"null" : is_hot.ToString());
					tw.Write(",");
					tw.Write("\"is_slide\":");
					tw.Write(is_slide==null?"null" : is_slide.ToString());
					tw.Write(",");
					tw.Write("\"is_sys\":");
					tw.Write(is_sys==null?"null" : is_sys.ToString());
					tw.Write(",");
					tw.Write("\"user_name\":");
					tw.Write("\"");
					tw.Write(user_name==null?"null":user_name);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"add_time\":");
					tw.Write("\"");
					tw.Write(add_time==null?"null":add_time.ToString());
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"update_time\":");
					tw.Write("\"");
					tw.Write(update_time==null?"null":update_time.ToString());
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"user_id\":");
					tw.Write(user_id==null?"null" : user_id.ToString());
			tw.Write("}");
		}
		#endregion
    }
}
